package com.rhb.cg.dbtool;

import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration; 
import org.hibernate.tool.hbm2ddl.SchemaExport;

public class DBTool {
	
	public static void createTable(String cf){
		try {
			Configuration cfg = new Configuration().configure(cf);
			SchemaExport schemaExport= new SchemaExport(cfg);
			schemaExport.create(true, true);
		} catch (HibernateException e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args){
		System.out.println("the classpath:");
		System.out.println(System.getProperty("java.class.path"));
		if(args!=null && args.length!=0){
			System.out.println("the arg is '" + args[0] + "'");
			String cfg = args[0];
			DBTool.createTable(cfg);
		}else{
			System.out.println("there is no arg!");
		}
	}
}